// 1.导入封装请求方法：request
import request from '@/utils/request'

export function loginApi(data) {
  return request({
    url: 'sys/login',
    method: 'post',
    data
  })
}

/**
 * @description: 获取用户资料
 * @param {*}
 * @return {*}
 */
export function getUserInfoApi() {
  return request({
    url: '/sys/profile',
    method: 'post'
  })
}

/**
 * @description: 获取用户头像
 * @param {*} id 用户id
 * @return {*}
 */
export function getUserDetailByIdApi(id) {
  return request({
    url: `/sys/user/${id}`
  })
}

export function getInfo(token) {
  return request({
    url: '/vue0admin-template.user.info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}
export default {
  namespaced: true,
  state: {
    thoken: ''
  },
  mutations: {
    setToken(state, token) {
      state.token = token
    },
    delToken(state) {
      state.token = ''
    }
  },
  actions: {

  }
}
